/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package servidorbancos.resources;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author luiz.perez
 */
@XmlRootElement(name="agencia")
public class Agencia implements Comparable<Agencia>
{
    String[] bancos = {"BB", "Santander", "Itau", "Caixa", "Bradesco", "HSBC", "Horas24", "Citibank", "Safra", "Sudameris"};
    String[] zonas = {"Norte", "Sul", "Leste", "Centro"};
    int banco, zona;
    double lat, lon;
    double distancia = 0;

    public int getBanco() {
        return banco;
    }

    public void setBanco(int banco) {
        this.banco = banco;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public double getLon() {
        return lon;
    }

    public void setLon(double lon) {
        this.lon = lon;
    }

    public int getZona() {
        return zona;
    }

    public void setZona(int zona) {
        this.zona = zona;
    }

    public double getDistancia() {
        return distancia;
    }

    public void setDistancia(double distancia) {
        this.distancia = distancia;
    }

    public Agencia() {}

    public Agencia(int banco, double lat, double lon, int zona) {
        this.banco = banco;
        this.lat = lat;
        this.lon = lon;
        this.zona = zona;
    }

    @Override
    public String toString() {
        return "Banco: " + bancos[banco] + " Zona: " + zonas[zona] + " Latitude: " + lat + " Longitude: " + lon + " Distancia: " + distancia;
    }

    @Override
    public int compareTo(Agencia o) {
        if(this.distancia > o.distancia)
        {
            return 1;
        }
        else if(this.distancia < o.distancia)
        {
            return -1;
        }
        else
        {
            return 0;
        }
    }
}